home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-03-03 | 2.2 KB | 84 lines | [TEXT/MSBB] |
- ' Drawing Count Program
- ' Converts Drawing Log Data created by FileMaker Plus
- ' and computes total number of drawings under each date
- ' By Dave Kelly
- ' ©1988
-
- DIM Charge$(1000),Date1(1000),Date2(1000),Date3(1000),Date4(1000)
- DIM tCharge$(20),tDate1(20),tDate2(20),tDate3(20),tDate4(20)
- filename$=FILES$(1,"TEXT")
- IF filename$="" THEN END
- OPEN "I",1,filename$
- OPEN "O",2,"Drawing Count.DATA"
- PRINT
- count=0
- CALL MOVETO(10,30)
- PRINT "Now Reading in Records..."
- WHILE NOT EOF(1)
- count=count+1
- CALL MOVETO (10,50)
- PRINT count
- Charge$(count)=""
- i$=""
- A$=""
- C$=""
- S$=""
- INPUT#1,Charge$(count),i$,A$,C$,S$
- IF LEN(Charge$(count))>0 THEN
- IF RIGHT$(Charge$(count),1)=")" THEN
- Charge$(count)=MID$(Charge$(count),LEN(Charge$(count))-4,4)
- ELSE
- Charge$(count)=RIGHT$(Charge$(count),4)
- END IF
- END IF
- IF LEN(i$)>0 THEN Date1(count)=1 ELSE Date1(count)=0
- IF LEN(A$)>0 THEN Date2(count)=1 ELSE Date2(count)=0
- IF LEN(C$)>0 THEN Date3(count)=1 ELSE Date3(count)=0
- IF LEN(S$)>0 THEN Date4(count)=1 ELSE Date4(count)=0
- WEND
- CALL MOVETO(10,70)
- PRINT "Now Sorting Data..."
- CALL Sort(count,Charge$(),Date1(),Date2(),Date3(),Date4())
- k=0
- FOR j=1 TO count
- IF tCharge$(k)<>Charge$(j) THEN k=k+1
- tCharge$(k)=Charge$(j)
- tDate1(k)=tDate1(k)+Date1(j)
- tDate2(k)=tDate2(k)+Date2(j)
- tDate3(k)=tDate3(k)+Date3(j)
- tDate4(k)=tDate4(k)+Date4(j)
- NEXT j
- CALL MOVETO(10,90)
- PRINT "Now Writing to File..."
- PRINT#2,"Charge# Date1 Date2 Date3 Date4"
- FOR i=1 TO k
- tDate1(i)=tDate1(i)-tDate2(i)
- tDate2(i)=tDate2(i)-tDate3(i)
- tDate3(i)=tDate3(i)-tDate4(i)
- PRINT #2,tCharge$(i),tDate1(i),tDate2(i),tDate3(i),tDate4(i)
- PRINT tCharge$(i),tDate1(i),tDate2(i),tDate3(i),tDate4(i)
- NEXT i
- CLOSE #1
- CLOSE #2
- PRINT"Click to continue..."
- WHILE MOUSE(0)<>1:WEND
- END
-
- SUB Sort(count,Charge$(),Date1(),Date2(),Date3(),Date4()) STATIC
- flips=1
- WHILE flips
- flips=0
- FOR i=2 TO count
- IF Charge$(i-1)> Charge$(i) THEN
- flips=1
- SWAP Charge$(i-1),Charge$(i)
- SWAP Date1(i-1),Date1(i)
- SWAP Date2(i-1),Date2(i)
- SWAP Date3(i-1),Date3(i)
- SWAP Date4(i-1),Date4(i)
- END IF
- NEXT
- WEND
- END SUB
-
-